"""django_646 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.http import HttpResponse
from book.views import book


def index(request):
    return HttpResponse('首页')


'''
str：非空的字符串类型。默认的转换器。但是不能包含斜杠    http://127.0.0.1:8000/book/1/
int：匹配任意的零或者正数的整形。到视图函数中就是一个int类型   http://127.0.0.1:8000/book/1/
slug：由英文中的横杠-，或者下划线_连接英文字符或者数字而成的字符串    http://127.0.0.1:8000/book/python_flask/
uuid：匹配uuid字符串  http://127.0.0.1:8000/book/0d091ebb-9683-46e9-9f00-763e20cadd63/
path：匹配非空的英文字符串，可以包含斜杠  http://127.0.0.1:8000/book/python/django/
'''
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', index),
    path('book/<path:book_id>/', book)
]
